﻿using MyCompany.WebCrawler.Interfaces;
using MyCompany.WebCrawler.Repositories;
using MyCompany.WebCrawler.Tasks.Tasks;

namespace MyCompany.WebCrawler.Tasks
{
    public class TasksFactory
    {
        private IDownloader downloader;
        private IRepository repository;
        private IUiFetcher uiFetcher;

        public TasksFactory(IDownloader downloader, IUiFetcher uiFetcher, IRepository repository)
        {
            this.downloader = downloader;
            this.repository = repository;
            this.uiFetcher = uiFetcher;
        }

        public ITask CreateShowNewLinkTask()
        {
            return new ShowNewLinksTask(uiFetcher, repository);
        }

        public ITask CreateGetLinks(string url)
        {
            var task = new GetLinksFromTask(this, downloader, repository);
            task.Url = url;

            return task;
        }

    }
}